package com.itheima.demo05;

import java.util.Scanner;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author Zhang_Han
 * @version 1.0
 * @date 2020/7/13 20:16
 */
public class Demo_008 {
    public static void main(String[] args) {
        /* corePoolSize：   核心线程的最大值，不能小于0
        maximumPoolSize：最大线程数，不能小于等于0，maximumPoolSize >= corePoolSize
        keepAliveTime：  空闲线程最大存活时间,不能小于0
        unit：           时间单位
        workQueue：      任务队列，不能为null
        threadFactory：  创建线程工厂,不能为null
        handler：        任务的拒绝策略,不能为null */
        /*ThreadPoolExecutor t = new ThreadPoolExecutor(2, 5, 3,
                10, TimeUnit.SECONDS, new ArrayBlockingQueue<>(1),
                Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());*/
    }
    ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1,
            3, 20, TimeUnit.SECONDS,
            new ArrayBlockingQueue<>(1), Executors.defaultThreadFactory(),
            new ThreadPoolExecutor.AbortPolicy());
}
